package com.xy.viewmodel.admin.user;

import com.xy.domain.Department;
import com.xy.domain.Major;
import com.xy.domain.User;
import com.xy.viewmodel.BaseVM;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class UserResponseVM extends BaseVM {
    /**
     *
     */
    private Integer id;

    /**
     *
     */
    private String nickname;

    /**
     *
     */
    private String realName;

    /**
     * 学号
     */
    private Long userNum;

    /**
     *
     */
    private String password;

    /**
     *
     */
    private Integer departNum;

    /**
     *
     */
    private Integer majorNum;

    /**
     *
     */
    private Long phone;

    /**
     *
     */
    private Integer role;

    /**
     *
     */
    private Integer status;

    /**
     *
     */
    private String avatar;

    /**
     *
     */
    private Date createTime;

    /**
     *
     */
    private Date updateTime;

    /**
     *
     */
    private Date lastActiveTime;

    /**
     *
     */
    private Boolean deleted;

    private List<Department> departments;

    private List<Major> majors;


    public static UserResponseVM from(User user) {
        UserResponseVM vm = modelMapper.map(user, UserResponseVM.class);
        // vm.setLastActiveTime(DateTimeUtil.dateFormat(user.getLastActiveTime()));
        // vm.setCreateTime(DateTimeUtil.dateFormat(user.getCreateTime()));
        // vm.setModifyTime(DateTimeUtil.dateFormat(user.getModifyTime()));
        return vm;
    }

}
